package com.example.opengldemo.util;

import android.view.View;

public final class ShaderResource {
    private String vertexString ;
    private String fragmentString ;
    private int program ;

    public ShaderResource(View view , String vertex , String fragment){
        this.vertexString = vertex ;
        this.fragmentString = fragment ;
        this.program = build(view) ;
    }

    private int build(View view ) {
        String mVertex= ShaderUtil.loadFromAssetsFile(vertexString, view.getResources());

        String mFragment=ShaderUtil.loadFromAssetsFile(fragmentString, view.getResources());

        return  ShaderUtil.createProgram(mVertex, mFragment);
    }

    public int getProgram(){
        return program ;
    }
}
